package com.wanmait.recruitment.controller;

import com.wanmait.recruitment.pojo.PoliticalStatus;
import com.wanmait.recruitment.service.PoliticalStatusService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("manage/political")
public class PoliticalListController {
    @Resource
    private PoliticalStatusService politicalStatusService;
    @RequestMapping("list")
    public void list(Model model){
        List<PoliticalStatus> politicalStatuses = politicalStatusService.findAll();
        model.addAttribute("politicalStatuses",politicalStatuses);
    }
    @RequestMapping("del")
    @ResponseBody
    public void del(String id){
        politicalStatusService.delete(Integer.parseInt(id));
    }
    @RequestMapping("insert")
    @ResponseBody
    public void insert(PoliticalStatus politicalStatus){
        politicalStatusService.insert(politicalStatus);
    }
    @RequestMapping("update")
    @ResponseBody
    public void update(PoliticalStatus politicalStatus){
        politicalStatusService.update(politicalStatus);
    }
}
